package cn.livingCloud.dto;

import cn.livingCloud.entity.core.Dept;
import cn.livingCloud.utils.DateUtils;
import cn.livingCloud.utils.GroupHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by DingJie on 2016/5/26.
 */
public class DeptDto implements GroupHelper.GroupKey {
    private String uuid;
    private String name;
    private String parentUuid;
    private String createDateTime;
    private boolean archive;
    private List<DeptDto> childDept = new ArrayList<>();

    public DeptDto() {
    }

    public DeptDto(Dept dept) {
        this.uuid = dept.getUuid();
        this.name = dept.getName();
        this.archive = dept.getArchive();
        this.createDateTime = DateUtils.toDateText(dept.getCreateDateTime()
                , DateUtils.DEFAULT_DATE_TIME_FORMAT);
        this.parentUuid = dept.getParentUuid();
    }

    public List<DeptDto> getChildDept() {
        return childDept;
    }

    public void setChildDept(List<DeptDto> childDept) {
        this.childDept = childDept;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getParentUuid() {
        return parentUuid;
    }

    public void setParentUuid(String parentUuid) {
        this.parentUuid = parentUuid;
    }

    public String getCreateDateTime() {
        return createDateTime;
    }

    public void setCreateDateTime(String createDateTime) {
        this.createDateTime = createDateTime;
    }

    public boolean isArchive() {
        return archive;
    }

    public void setArchive(boolean archive) {
        this.archive = archive;
    }

    @Override
    public Object getKey() {
        return name.substring(name.length() - 1, name.length());
    }
}
